import subprocess
import time

res = subprocess.check_output('route -n', shell=True)
res = res.decode('utf-8')
rel = res.splitlines()
rel = rel[1:]

rel2 = []
for lines in rel:
    rel2 = lines.split()
    if 'eth0' in rel2:
        if rel2[1] != '0.0.0.0':
            eth0str = 'route add -net 0.0.0.0 gw %s dev eth0 metric 100'%(rel2[1])
# print(rel)



while True:
    file = open('./logfile.log','a')
    file.write(res)
    file.close()
    print('1')
    time.sleep(5)
